package com.hdc.autotest;

import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;

import java.time.Duration;

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class AutoTest4 {
    private static ChromeDriver driver = new ChromeDriver();

    @Test
    @Order(1)
    void test1() throws InterruptedException {
        driver.get("https://www.baidu.com");
        Thread.sleep(1000);
        driver.findElement(By.cssSelector("#kw")).sendKeys("hello");
    }

    @Test
    @Order(2)
    void test2() {
        driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(2));
        driver.findElement(By.cssSelector("#su")).click();
    }

    @Test
    @Order(3)
    void test3() throws InterruptedException {
        Thread.sleep(5000);
        driver.quit();
    }
}
